home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18426 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1022 b 

  1. Path: ix.netcom.com!news
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.sys.sgi.apps,comp.lang.c++
  4. Subject: Re: SGI's C++ compiler and the boolean type
  5. Date: Sat, 20 Apr 1996 02:37:25 GMT
  6. Organization: Netcom
  7. Message-ID: <31784d88.187788215@nntp.ix.netcom.com>
  8. References: <4kefm7$oao@ncar.ucar.edu> <4kg6fv$h7k@nic.ftns.no> <31770390.2781@llnl.gov>
  9. NNTP-Posting-Host: ix-dc12-18.ix.netcom.com
  10. X-NETCOM-Date: Fri Apr 19  9:34:34 PM CDT 1996
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. Scott Nelson <nelson18@llnl.gov> wrote:
  14.  
  15. > Arthur Hagen wrote:
  16. > > 
  17. > > >
  18. > > > typedef int     bool;
  19. > > > #define true    1
  20. > > > #define false   0
  21. > > 
  22. > > And some argue that true should be -1, because then bitwise not works:
  23. > > 
  24. > We use the following.  It's safe on all platforms:
  25. > #define FALSE    0
  26. > #define TRUE   (!0)
  27. > Let the built-in ! operator determine what TRUE really is.
  28.  
  29. How is that safer than
  30.  
  31.     #define FALSE 0
  32.     #define TRUE 1
  33.  
  34. !0 is guaranteed to be 1 in both C and C++.
  35.  
  36.  
  37. Michael M Rubenstein
  38.